﻿using System;
using IFDB.Models;
using IFDB.Models.Tables;
using IFDB.ResourceLibrary;

namespace IFDB.ViewModels.PartialViewModels
{
    public class AppearanceItemViewModel : IComparable<AppearanceItemViewModel>
    {
        public Person Person { get; set; }
        public int Played { get; set; }
        public int Goals { get; set; }
        public int OwnGoals { get; set; }
        public int YellowCards { get; set; }
        public int RedCards { get; set; }

        public int CompareTo(AppearanceItemViewModel other)
        {
            if (Person.Position != other.Person.Position)
                return Person.Position.CompareTo(other.Person.Position);

            return Played != other.Played ? other.Played.CompareTo(Played) : Person.Surname.CompareTo(other.Person.Surname);
        }
    }
}
